<?php
	include_once('includeFiles.php');
	
	include_once(CFG_LIB_DIR.'add_modify.php');
	$objAddModify = new clsAddModify();
	
	extract($_POST);
	
	$action  = $_POST['action'];
	$yancode = $_POST['yancode'];

	if ($_SESSION['seccode']=="" || trim($yancode)!=$_SESSION['seccode']){
		$objBase->popup("对不起,验证码不正确,请重新输入！");				
	}
	
	if ($action == "save"){
		$name     = html_entity_decode($_POST['name']);
		$company  = html_entity_decode($_POST['company']);
		$sex      = html_entity_decode($_POST['sex']);
		$phone    = html_entity_decode($_POST['phone']);
		$headface = html_entity_decode($_POST['headface']);
		$email    = html_entity_decode($_POST['email']);
		$address  = html_entity_decode($_POST['address']);
		$title    = html_entity_decode($_POST['title']);
		$face     = html_entity_decode($_POST['face']);
		$guest_lan= html_entity_decode($_POST['guest_lan']);
		$msg      = html_entity_decode($_POST['msg']);
		$date     = date("Y-m-d H:i:s");
		$ip       = $objBase->getUserIp();
		
		$arr = array(
			"guest_name"    => $name,
			"guest_title"   => $title,
			"guest_company" => $company,
			"guest_email"   => $email,
			"guest_face"    => $face,
			"guest_lan"     => $guest_lan,
			"guest_content" => $msg,
			"guest_date"    => $date,
			"guest_homepage"=> $headface,
			"guest_sex"     => $sex,
			"guest_flag"    => 1 ,
			"guest_contact" => $phone,
			"guest_ip"      => $ip,
		);
		
		$sql = $hb-> insert("", $arr);
		$objAddModify->vodExecute("hy_b_guestbook", $sql, $_SERVER['HTTP_REFERER']);
	}	
?>